package com.lc.advertising.ui.activity;

import android.os.Bundle;

import com.flyco.tablayout.SlidingTabLayout;
import com.lc.advertising.R;
import com.lc.advertising.app.AppActivity;
import com.lc.advertising.ui.adapter.MyFragmentPagerAdapter;
import com.lc.advertising.ui.fragment.OrderListAllFragment;
import com.lc.advertising.ui.fragment.OrderListFragment;

import java.util.ArrayList;
import java.util.List;

import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class OrderActivity extends AppActivity {
    @BindView(R.id.slidingTabLayout)
    SlidingTabLayout slidingTabLayout;
    @BindView(R.id.viewpager)
    ViewPager viewpager;
    private MyFragmentPagerAdapter mAdapter;

    private List<String> titles = new ArrayList<>();//title集合

    private List<Fragment> fragments = new ArrayList<>();//碎片集合
    @Override
    protected int getLayoutId() {
        return R.layout.activity_order;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
        titles.add("全部");
        titles.add("抢单");


        fragments.add(OrderListAllFragment.newInstance("2"));
        fragments.add(OrderListFragment.newInstance("1"));

        mAdapter = new MyFragmentPagerAdapter(getSupportFragmentManager(), fragments, getContext(), titles);
        viewpager.setAdapter(mAdapter);
        slidingTabLayout.setViewPager(viewpager);
    }

    @OnClick(R.id.image_back)
    public void onClick() {
        finish();
    }
}
